#include <stdio.h>
#include "sidecar.h"
#include "strings.h"

struct test_struct {
  int a;
  int b;
};

int
main()
{
  set_int_value("www.ftp.com", "int", 123);
  long long a = get_int_value("www.ftp.com", "int");

  printf("%lld\n", a);

  set_float_value("www.ftp.com", "double", 0.2f);
  double b = get_float_value("www.ftp.com", "double");

  printf("%lf\n", b);

  set_str_value("www.ftp.com", "str", "aabbcc", 6);

  char s[7];
  bzero(s, 7);
  size_t str_len;
  get_str_value("www.ftp.com", "str", s, &str_len);
  printf("%s[%lu]\n", s, str_len);

  struct test_struct ts;
  ts.a = 1;
  ts.b = 2;

  set_struct_value("www.ftp.com", "struct", (char*) (&ts), sizeof(struct test_struct));

  struct test_struct ts2;
  bzero(&ts2, sizeof(struct test_struct));

  size_t struct_len;
  get_struct_value("www.ftp.com", "struct", (char*) (&ts2), &struct_len);
  printf("ts2.a = [%d], ts2.b = [%d], size: [%lu]\n", ts2.a, ts2.b, struct_len);
}
